﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DarkAngels.WoW.Library.Armory.Character;
using DarkAngels.WoW.Library.Armory.Character.tabs;

namespace SmartDeviceProject1.Controls
{
    public partial class AchievementPanel : UserControl
    {
        public AchievementPanel()
        {
            InitializeComponent();
            SetupProgressbars();
        }

        Character m_character = null;
        public void SetCharacter(Character c)
        {
            c.Load();
            m_character = c;
            //m_achievements = c.AchievementsInfo;
            //m_achievements.Load();
            SetupProgressbars();
        }

        void SetupProgressbars()
        {
            Bornander.UI.ProgressBar.ProgressBar[] bars = new Bornander.UI.ProgressBar.ProgressBar[] {
                this.progressBar1,
                this.progressBar2,
                this.progressBar3,
                this.progressBar4,
                this.progressBar5,
                this.progressBar6,
                this.progressBar7,
                this.progressBar8,
                this.progressBar9
            };

            Random r = new Random();
            for (int i = 0; i < bars.Length; i++)
            {
                bars[i].Left = 0;
                bars[i].Top = i * ((this.ClientSize.Height - 50) / bars.Length);
                bars[i].Width = this.ClientSize.Width;
                bars[i].Height = ((this.ClientSize.Height - 50) / bars.Length);

                //set up images for bars
                bars[i].ForegroundPicture = SmartDeviceProject1.Properties.Resources.vista_foreground;
                bars[i].BackgroundPicture = SmartDeviceProject1.Properties.Resources.vista_background;
                bars[i].OverlayPicture = SmartDeviceProject1.Properties.Resources.vista_overlay;
                bars[i].BackgroundDrawMethod = Bornander.UI.ProgressBar.ProgressBar.DrawMethod.Stretch;
                bars[i].BackgroundLeadingSize = 12;
                bars[i].BackgroundTrailingSize = 12;
                bars[i].ForegroundDrawMethod = Bornander.UI.ProgressBar.ProgressBar.DrawMethod.Stretch;
                bars[i].ForegroundLeadingSize = 12;
                bars[i].ForegroundTrailingSize = 12;
                bars[i].OverlayDrawMethod = Bornander.UI.ProgressBar.ProgressBar.DrawMethod.Stretch;
                bars[i].OverlayLeadingSize = 12;
                bars[i].OverlayTrailingSize = 12;
                bars[i].MarqueeWidth = 10;
                bars[i].Marquee = Bornander.UI.ProgressBar.ProgressBar.MarqueeStyle.TileWrap;
                bars[i].Type = Bornander.UI.ProgressBar.ProgressBar.BarType.Progress;

                //show some random data for test purpose
                bars[i].Maximum = 500;
                bars[i].Minimum = 0;
                bars[i].Value = r.Next(1, 500);
                bars[i].MarqueeUpdate();

                this.progressBar1.Value = bars[i].Value;
                this.progressBar1.Minimum = 0;
                this.progressBar1.Maximum = 500;
            }
        }
    }
}

